'''
Author: caishuyang
Date: 2023-03-06 08:04:55
LastEditors: caishuyang
LastEditTime: 2023-03-06 09:42:43
Description: 
'''
import torch
from _01XlsReader import *

class Publisher():
    def __init__(self,feature_num,label_num,modelpath="model\\model_01.pth"):
        self.flag=True
        self.feature_num=feature_num
        self.label_num=label_num
        self.model=torch.load(modelpath)

    def pub(self,recieve_q,pub_qlist):
        trans=XlsReader(self.feature_num,self.label_num)
        while self.flag:
            oridata=recieve_q.get()
            oridata=trans.normalFeature(oridata)
            pubdata=self.model(oridata)
            for pub_q in pub_qlist:
                if pub_q.full():
                    pub_q.get()
                pub_q.put(pubdata)

if __name__ == "__main__":
    publish=Publisher(8,2)
    pass
